package com.itao.spel;

import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;

import java.util.List;

/**
 * 内联列表
 * @author sjt
 * @Date 2024/10/9 9:47
 */
public class InlineLists {

    @SuppressWarnings("rawtypes")
    public static void main(String[] args) {
        ExpressionParser parser = new SpelExpressionParser();
        // evaluates to a Java list containing the four numbers
        List numbers = (List) parser.parseExpression("{1,2,3,4}").getValue(); //
        System.out.println(numbers); //[1, 2, 3, 4]
        List listOfLists = (List) parser.parseExpression("{{'a','b'},{'x','y'}}").getValue();
        System.out.println(listOfLists); // [[a, b], [x, y]]
    }
}
